home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / sourceaga / object.s < prev    next >
Text File  |  1994-01-21  |  54KB  |  2,563 lines

  1.  
  2. ;rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. ;ocs            ;off=AGA,on=OCS testing not possible on OCS !
  11.  
  12. routinemode    equ    14431    ;the routinemode !
  13.  
  14.  
  15. ; VideoTracker AGA developer source 25-12-93
  16. ; 24-bits colors, Super-HiRes, HAM8, maximum burstmode (64 pixels aligned)
  17. ; wich makes low-resolution overscan a bit ugly.
  18. ; no "interactive" support anymore, it's only used by Kick 1.3 users.
  19.  
  20. ; the first part of the source handles the things that are necessary to
  21. ; show the picture/copper and playing of the routine.
  22. ; the part between the "***" lines is the routine-source.
  23. ; at the bottom of the file, there are the necessary incbin-files who
  24. ; are needed to test the routine.
  25. ; these are saved with "save effect" in videotracker. they are raw
  26. ; data files which can be fonts,pictures,landscapes,vectorobjects
  27. ; etcetra.
  28. ; the incbin-files are put in the "variables" table, in the routine-
  29. ; player-handler
  30. ; the place where it's done can be found by searching for "!!!"
  31.  
  32.     opt    a+    ;devpac 3 optimize
  33.     opt    o+
  34.  
  35. vew_wid    equ    48
  36. vew_hgt    equ    290
  37. win_hgt    equ    117
  38. win_str    equ    $1a
  39.  
  40.         ifd    ocs
  41. pic_wid        equ    4        ;wide in bytes
  42. pic_hgt        equ    6        ;hoogte
  43. pic_dpt        equ    8        ;number planes
  44. pic_ani        equ    10        ;aantal effes (anim)
  45. pic_vew        equ    12        ;viewmode
  46. pic_cycstr    equ    14        ;cycle start (*4)
  47. pic_cycend    equ    15        ;cycle end (*4)
  48. pic_cycspd    equ    16        ;cycle speed (*4)
  49. pic_cycadd    equ    17        ;cycle add (*4)
  50. pic_palnum    equ    30        ;aantal kleuren
  51. pic_pal        equ    32        ;palette start
  52. pic_palsiz    equ    256*2        ;vaste palette size
  53. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  54.         endc
  55.         
  56.         ifnd    ocs
  57. pic_wid        equ    4        ;wide in bytes
  58. pic_hgt        equ    6        ;hoogte
  59. pic_dpt        equ    8        ;number planes
  60. pic_ani        equ    10        ;aantal effes (anim)
  61. pic_vew        equ    12        ;viewmode
  62. pic_cycstr    equ    14        ;cycle start (*8)
  63. pic_cycend    equ    15        ;cycle end (*8)
  64. pic_cycspd    equ    16        ;cycle speed (*8)
  65. pic_cycadd    equ    17        ;cycle add (*8)
  66. pic_widmod    equ    46        ;animation-width modulo
  67. pic_future    equ    50        ;free future space
  68. pic_palnum    equ    62        ;aantal kleuren
  69. pic_pal        equ    64        ;palette start
  70. pic_palsiz    equ    256*4        ;vaste palette size (longwords)
  71. pic_raw        equ    pic_pal+pic_palsiz    ;palette start
  72.         endc
  73.         
  74. var_len        equ    $300        ;lengte vartabel
  75.  
  76. var__GfxBase    equ    $000        ;graphics lib
  77. var_pic1    equ    $004        ;current picture
  78. var_anispd1    equ    $008        ;animspeed
  79. var_anitel1    equ    $00c        ;animcount
  80. var_cprbck    equ    $010        ;copperback
  81. var_bck        equ    $014        ;background
  82. var_pic2    equ    $018        ;current picture
  83. var_ntsc    equ    $01c        ;ntsc/pal frequence
  84. var_lnd        equ    $020        ;landscape
  85. var_anilop1    equ    $024
  86. var_rottrg    equ    $028        ;effect trigger
  87. var_txt1    equ    $040        ;text
  88. var_txt16    equ    15*4+var_txt1
  89. var_vec1    equ    $080        ;vectors
  90. var_vec16    equ    15*4+var_vec1
  91. var_fon1    equ    $0c0        ;fonts
  92. var_fon16    equ    15*4+var_fon1
  93. var_cols1    equ    $100        ;colorsets
  94. var_cols16    equ    15*4+var_cols1
  95. var_obj1    equ    $180        ;objects
  96. var_obj16    equ    15*4+var_obj1
  97.  
  98.     ifd    rout
  99.     ;videotracker routine-test
  100.  
  101.     incdir    "videotracker:include/"
  102.     include    "exec/types.i"
  103.     include    "graphics/gfxbase.i"
  104.     include    "lvo/graphics_lib.i"
  105.     incdir    'videotracker:effect/'
  106.  
  107.     SECTION    1,CODE_C
  108. tus
  109.     lea    var,a0
  110.     move.l    #rotincobj,var_obj1(a0)    ;incbinfile !!!
  111.     move.l    #rotincbck,var_bck(a0)    ;incbinfile !!!
  112.  
  113. ;    move.l    #rottube,var_vec1(a0)    ;incbinfile !!!
  114. ;    move.l    #rotsrc,curpic1        ;picture !!!
  115. ;    move.l    #rotsrc,curpal1        ;palette !!!
  116. ;    move.l    #rotset,var_cols1(a0)    ;colorset !!!
  117.  
  118.     bsr    paltabres
  119.  
  120.     move.l    ($4).w,a6
  121.     sub.l    a1,a1
  122.     jsr    -$126(a6)        ;findtask
  123.     move.l    d0,curtsk
  124.     move.l    d0,a0
  125.     move.l    $b8(a0),tskpri
  126.  
  127.     lea    dosnam,a1        ;doslib openen
  128.     moveq.l    #0,d0
  129.     move.l    (4).w,a6
  130.     jsr    -408(a6)        ;openlib
  131.     move.l    d0,doslib
  132.  
  133.     bsr.s    label5            ;videotracker opstarten
  134.     
  135.     move.l    curtsk,a0
  136.     move.l    tskpri,$b8(a0)
  137.     move.l    ($4).w,a6
  138.     jsr    -$84(a6)        ;forbid
  139.  
  140.     move.l    doslib,a1
  141.     move.l    (4).w,a6
  142.     jsr    -414(a6)        ;closelib
  143.  
  144.     moveq.l    #0,d0
  145.     rts
  146.     
  147. label5
  148.     move.l    (4).w,a6        ;workbench gedoe
  149.  
  150.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  151.  
  152.     ifd    ntsctest
  153.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  154.     endc
  155.  
  156.     cmp.b    #50,ntscmode        ;ntsc ?
  157.     beq.s    str.ntsc
  158.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  159. str.ntsc
  160.  
  161.     lea    cprjmp,a2        ;copjmp zetten !
  162.     move.l    #cprbck-8,d0
  163.     move.w    d0,6(a2)
  164.     swap    d0
  165.     move.w    d0,2(a2)
  166.  
  167.     lea    cprbck-8,a2        ;copstr zetten !
  168.     move.l    #cpr,d0
  169.     move.w    d0,6(a2)
  170.     swap    d0
  171.     move.w    d0,2(a2)
  172.  
  173.     bsr    cprsprrem        ;sprites legen
  174.  
  175.     lea    gfxnam,a1        ;graphics lib openen
  176.     move.l    (4).w,a6
  177.     jsr    -408(a6)        ;openlib
  178.     move.l    d0,a6
  179.     move.l    d0,gfxlib
  180.     move.l    38(a6),oldcprlist
  181.  
  182.     bset    #1,$bfe001
  183.     bsr    copbuf            ;copper vullen
  184.  
  185.     bsr    sysoff
  186.  
  187. gadrun
  188.     btst    #6,($bfe001).l
  189.     bne    gadrun
  190.  
  191. scrend
  192. scrend.play
  193.     bsr    syson
  194.  
  195.     move.l    gfxlib,a1
  196.     move.l    (4).w,a6
  197.     jsr    -414(a6)        ;closelib
  198.  
  199. scrend.qb
  200.     moveq.l    #0,d0    
  201.     rts
  202.     
  203.     ;vertical blank interrupt, no blits.
  204.     ;handles counters,interlace,sprite
  205.     ;level 3
  206.  
  207. intvb
  208.     bra.s    intvb.cnt
  209.     dc.l    'VIDU'
  210.     dc.l    'LOOP'
  211. intvb.cnt
  212.     movem.l    d0-d7/a0-a6,-(sp)
  213.     lea    ($dff000).l,a6
  214.  
  215.     move.w    $01e(a6),d0
  216.     btst    #5,d0            ;vblank ?
  217.     bne.s    intvb.vb
  218.  
  219.     bra.s    intcop.end
  220.  
  221. intvb.vb
  222.     bsr    grap
  223.     bsr    palctr            ;palette zetten
  224.     bsr.s    copbuf            ;copper vullen
  225.     
  226. intvb.end
  227.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  228.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  229.     rte
  230.  
  231. intcop.end
  232.     movem.l    (sp)+,d0-d7/a0-a6
  233.     move.l    intvbold,-(sp)
  234.     rts
  235.  
  236.     ;transmission buffer empty routine, BLIT !
  237.     ;handles routines,animations
  238.     
  239. inttbe                    ;tbe interrupt
  240.     movem.l    d0-d7/a0-a6,-(sp)
  241.     lea    ($dff000).l,a6
  242.  
  243.     move.w    $01e(a6),d0
  244.     btst    #0,d0            ;no tbe ?
  245.     beq.s    intdskblk
  246.  
  247.  
  248.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  249.     beq.s    inttbe.cop
  250.     btst    #2,($dff016).l
  251.     beq.s    inttbe.cop
  252.  
  253.     ifd    debug
  254.     move.w    #$700,$dff180
  255.     endc
  256.     
  257.     bsr    rotply            ;routineplayer BLIT !
  258.     bsr.s    copbuf            ;copper vullen
  259.  
  260.     ifd    debug
  261.     move.w    #$070,$dff180
  262.     endc
  263.     
  264. inttbe.cop
  265.  
  266. inttbe.end
  267.     move.w    #$0001,$09c(a6)
  268.     movem.l    (sp)+,d0-d7/a0-a6
  269.     rte
  270.  
  271. intdskblk
  272.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  273.     movem.l    (sp)+,d0-d7/a0-a6
  274.     move.l    inttbeold,-(sp)
  275.     rts
  276.  
  277.  
  278.     ;moves the copperbuffer to the copperlist
  279.     ;sort of double buffering
  280.     
  281. copbuf
  282.     movem.l    d0-d7/a0-a6,-(sp)
  283.  
  284.     lea    ($dff000).l,a6
  285.  
  286. copbuf.novb                ;copperchange overslaan
  287.     moveq.l    #0,d0
  288.     move.b    $005(a6),d0
  289.     lsl.w    #8,d0
  290.     moveq.l    #0,d1
  291.     move.b    $006(a6),d1
  292.     add.w    d1,d0
  293.  
  294.     cmp.w    #$4,d0            ;lower limit, all stations 100%
  295.     blt    copbuf.novb
  296.  
  297.     cmp.b    #50,ntscmode
  298.     beq.s    copbuf.pal
  299.     cmp.w    #$133-72-8,d0        ;ntsc grens
  300.     bge    copbuf.novb
  301.     bra.s    copbuf.cont
  302. copbuf.pal
  303.     cmp.w    #$133-8,d0        ;pal grens
  304.     bge    copbuf.novb
  305. copbuf.cont
  306.  
  307.     lea    gra.s,a0        ;buffer copieren
  308.     lea    cprbuf,a1
  309. copbuf_aga                ;AGA stuff :)
  310.     move.l    #(gra.ql)/4-1,d0
  311. copbuf.a
  312.     move.w    2(a0),2(a1)
  313.     add.l    #4,a0
  314.     add.l    #4,a1
  315.     dbra    d0,copbuf.a
  316.  
  317. copbuf.end
  318.     movem.l    (sp)+,d0-d7/a0-a6
  319.     rts
  320.  
  321.     ;goes back to the workbench
  322.     
  323. syson
  324.     movem.l    d0-d7/a0-a6,-(sp)
  325.  
  326.     move.w    #$0001,$dff09a        ;tbeint uit
  327.     move.l    intvbold,($6c).w
  328.     move.l    inttbeold,($64).w
  329.  
  330.     move.l    4,a6
  331.     jsr    -138(a6)        ;permit
  332.  
  333.     move.l    gfxlib,a6
  334.     jsr    -462(a6)        ;disownblitter
  335.  
  336.     move.l    wbview,a1
  337.     move.l    gfxlib,a6
  338.     jsr    _LVOLoadView(a6)     ; Fix view
  339.     jsr    _LVOWaitTOF(a6)
  340.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  341.  
  342. syson.ras
  343.     cmp.b    #$c0,$dff006        ;prevent copperjump
  344.     bne    syson.ras
  345.  
  346.     move.l    gfxlib,a6
  347.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  348.  
  349.     movem.l    (sp)+,d0-d7/a0-a6
  350.     rts
  351.     
  352.     ;goes back to the gadgetscreen
  353.     
  354. sysoff
  355.     movem.l    d0-d7/a0-a6,-(sp)
  356.      
  357.     move.l    gfxlib,a6
  358.     move.l    gb_ActiView(a6),wbview    ;current view
  359.     sub.l    a1,a1            ; clear a1
  360.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  361.     jsr    _LVOWaitTOF(a6)     ; Wait once
  362.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  363.  
  364.     move.l    gfxlib,a6
  365.     jsr    -456(a6)        ;ownblitter
  366.  
  367.     move.l    4,a6
  368.     jsr    -132(a6)        ;forbid
  369.         
  370.     move.l    ($6c).w,intvbold
  371.     move.l    #intvb,($6c).w
  372.     move.l    ($64).w,inttbeold
  373.     move.l    #inttbe,($64).w
  374.     move.w    #$8001,$dff09a        ;tbeint aan
  375.     bsr    gracpr            ;reset copper
  376.     bsr    copbuf            ;copy copper
  377.     move.l    #cpr,$dff080
  378.  
  379.     movem.l    (sp)+,d0-d7/a0-a6
  380.     rts
  381.     
  382. cprsprrem
  383.     movem.l    d0-d7/a0-a6,-(sp)
  384.     lea    cprspr,a0
  385.     move.l    #sprdat,d0
  386.     move.w    #7,d1
  387. cprsprrem.a
  388.     move.w    d0,3*2(a0)
  389.     swap    d0
  390.     move.w    d0,1*2(a0)
  391.     swap    d0
  392.     add.l    #8,a0
  393.     dbra    d1,cprsprrem.a
  394.     movem.l    (sp)+,d0-d7/a0-a6
  395.     rts
  396.  
  397. varset                    ;variablen neerzetten
  398.     movem.l    d0-d7/a0-a6,-(sp)
  399.     move.l    #var,a0
  400.  
  401.     move.l    #cprbck,var_cprbck(a0)
  402.     move.l    gfxlib,var__GfxBas